package com.emontis.notiztapete.pages.notes;

import org.apache.tapestry5.annotations.Persist;
import org.apache.tapestry5.hibernate.annotations.CommitAfter;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.hibernate.Session;
import com.emontis.notiztapete.entities.Note;
import com.emontis.notiztapete.pages.Index;

public class EditNotes
{
  @Persist
  private Note note;

  public Note getNote ()
  {
    return this.note;
  }

  public void setNote (Note note)
  {
    this.note = note;
  }

  @Inject
  private Session session;

  @CommitAfter
  Object onSuccess ()
  {
    this.session.update(this.note);
    return Index.class;
  }

}
